import service from "../utils/request";

// 文档上传
export const Upload = (params: any) => {
  return service.post("/api/v1/word/upload", params, {
    headers: {
      // 浏览器会自动设置正确的 Content-Type（含 multipart 边界）
      "Content-Type": "multipart/form-data",
    },
  });
};

// 文档检测
export const Analysis = (params: any) => {
  return service.post("/api/v1/word/analysis", params, {
    headers: {
      // 浏览器会自动设置正确的 Content-Type（含 multipart 边界）
      "Content-Type": "application/json;charset=utf-8",
    },
  });
};

// 检测结果
export const Result = (params: any) => {
  return service.post("/api/v1/word/resEdit", params, {
    headers: {
      // 浏览器会自动设置正确的 Content-Type（含 multipart 边界）
      "Content-Type": "application/json;charset=utf-8",
    },
  });
};

// 检测结果展示
export const resList = (params: any) => {
  return service.get("/api/v1/word/resList", {
    params,
    headers: {
      "Content-Type": "application/json;charset=utf-8",
    },
  });
};

// 存草稿
export const SaveDraft = (params: any) => {
  return service.post("/api/v1/word/saveDraft", params, {
    headers: {
      // 浏览器会自动设置正确的 Content-Type（含 multipart 边界）
      "Content-Type": "application/json;charset=utf-8",
    },
  });
};

// 获取列表
export const GetList = (params: any) => {
  return service.post("/api/v1/word/list", params);
};

// 获取详情
export const GetDetail = (params: any) => {
  return service.get("/api/v1/word/detail/" + params.id,{
    headers: {
      "Content-Type": "multipart/form-data",
    },
  });
};